import request from '@/request'

export function login(account, password) {
  const data = {
    account,
    password
  }
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

// step5：从@store来的，并把参数已经赋值给了token，发送请求给后端
export function logout(token) {
  return request({
    headers: {
      'apiToken': token
    },
    url: '/logout',
    method: 'get'
  })
}

export function register(email, account, password) {
  const data = {
    email,
    account,
    password
  }
  return request({
    url: '/register',
    method: 'post',
    data
  })
}
